/** 
 * @ClassName:     SmsSendDao.java 
 * @Description:   TODO(用一句话描述该文件做什么)  
 * @author         wangzhe  
 * @Date           2019年7月22日 上午10:27:13  
 */  


package com.huitone.smspfm.oldclient.dao;

import java.lang.reflect.Array;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.jdbc.core.BeanPropertyRowMapper;

import com.huitone.smspfm.oldclient.dao.entity.SmsSend;

public class SmsSendDao extends BaseDao<SmsSend>{
	
	public List<SmsSend> getAllObj(int num) {
		return jdbcTemplate.query("SELECT * FROM " + tableName + " where rownum<= ?", new Object[]{num} ,new BeanPropertyRowMapper<SmsSend>(SmsSend.class));
	}
	
	public int[] deleteObj(List<SmsSend> smsSends) {
		List<Object[]> list = new ArrayList<>();
		for(SmsSend sms:smsSends){
			list.add(new Object[]{sms.getSerialNo()});
		}
		return jdbcTemplate.batchUpdate("DELETE  FROM " + tableName + " WHERE SERIALNO = ?", list, new int[]{Types.VARCHAR});
	}

}
